﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;
using System.IO;
using System.Data.SqlClient;
using System.Data;

namespace Jxym.wlkc2011.Module.Default.server.DbBack
{
    public partial class dbBack_List : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string returnStr = "";
                SqlConnection conn = new SqlConnection(Jxym.DBUtility.JxymSqlHelper.ConnectionStringMaster);
                SqlCommand cmdBK = new SqlCommand();
                cmdBK.CommandType = CommandType.Text;
                cmdBK.Connection = conn;
                cmdBK.CommandText = @"select filePath=f_getdbpath('AIMS'),defaultDataPaht=f_getdbpath(''),defaultBackPaht=f_getdbpath(null)";
                try
                {
                    conn.Open();
                    using (SqlDataReader sdr = cmdBK.ExecuteReader())
                    {
                        if (sdr.Read())
                        {
                            returnStr += "filePath=" + (sdr["filePath"] != DBNull.Value ? sdr["filePath"].ToString() : "-") + ",";
                            returnStr += "defaultDataPaht=" + (sdr["defaultDataPaht"] != DBNull.Value ? sdr["defaultDataPaht"].ToString() : "-") + ",";
                            returnStr += "defaultBackPaht=" + (sdr["defaultBackPaht"] != DBNull.Value ? sdr["defaultBackPaht"].ToString() : "-");
                        }
                    }
                }
                catch (Exception ex)
                {
                    returnStr = ex.Message;
                }
                finally
                {
                    conn.Close();
                    conn.Dispose();
                }
                Response.Write(returnStr);
            }
        }
    }

    public class DbBackInfo
    {
        private DateTime backTime = DateTime.Now;

        public DateTime BackTime
        {
            get { return backTime; }
            set { backTime = value; }
        }
        private string backTitle = DateTime.Now.ToFileTime().ToString();

        public string BackTitle
        {
            get { return backTitle; }
            set { backTitle = value; }
        }

        private string filePath;

        public string FilePath
        {
            get { return filePath; }
            set { filePath = value; }
        }
    }
}